//
//  NotificationTableViewCell.m
//  carcareIOS
//
//  Created by wr on 15/7/6.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#import "NotificationTableViewCell.h"
#define CELL_HEIGHT (45)
@interface NotificationTableViewCell()

@property (nonatomic , strong) UILabel * titleL;

@property (nonatomic , strong) UILabel * detailL;

@property (nonatomic , strong) UIView * lineV;

@end

@implementation NotificationTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        CGFloat labelX = 15 * __MAIN_RATIO_375;
        CGFloat titleLabelW = 115;
        self.titleL = [[UILabel labelWithFrame:CGRectMake(labelX, 0, titleLabelW, CELL_HEIGHT) font:FONT_TABLE_TITLE text:@"" textColor:[Theme wordColor]] setupOnView:self];
        self.titleL.numberOfLines = 1;
        
        CGFloat switchW = 45;
        CGFloat switchH = 31;
        self.switchClick = [[UISwitch alloc]initWithFrame:CGRectMake(__MAIN_WIDTH - switchW - 15, (CELL_HEIGHT - switchH) / 2, switchW, switchH)];
        [self addSubview:_switchClick];
        
        CGFloat titleDetailLW = __MAIN_WIDTH - labelX - titleLabelW - ( __MAIN_WIDTH - self.switchClick.left) - 8 * __MAIN_RATIO_375;
        self.detailL = [[[UILabel labelWithFrame:CGRectMake(self.titleL.right, 0, titleDetailLW, CELL_HEIGHT) font:FONT_DEFAULT_Light(12) text:@"" textColor:[Theme wordGrayNewColor]] setupOnView:self] labelResetTextAlignment:NSTextAlignmentRight];
        
        self.lineV = [[[UIView viewWithFrame:CGRectMake(0, 0, __MAIN_WIDTH, 0.5)] resetBackgroundColor:[Theme lineColor]] setupOnView:self];

    }
    return  self;
}
- (void)setTitleStr:(NSString *)titleStr
{
    _titleStr = titleStr;
    self.titleL.text = titleStr;
}
- (void)setDetailStr:(NSString *)detailStr
{
    _detailStr = detailStr;
    self.detailL.text = detailStr;
}
- (void)reloadBigCellHeight:(CGFloat)height
{
    self.lineV.hidden = YES;
    [self.titleL setTop:(height - self.titleL.height) / 2];
    [self.detailL setTop:(height - self.detailL.height) / 2];
    [self.switchClick setTop:(height - self.switchClick.height) / 2];
    
    [self.titleL setLeft:cellLeft];
    [self.detailL setLeft:self.titleL.right];
    [self.detailL setWidth:__MAIN_WIDTH - self.titleL.right - (__MAIN_WIDTH - self.switchClick.left) - 8 * __MAIN_RATIO_375 ];
}
+ (CGFloat)getCellHeight
{
    return CELL_HEIGHT;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
